package lib.bone.flow.domain.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.util.Date;

/**
 * @author: kindear
 * 流程定义表
 */

@Data
@Entity
@Table(name = "flow_define")
@GenericGenerator(name = "jpa-uuid", strategy = "uuid")
@EntityListeners(AuditingEntityListener.class)
public class FlowDefine {
    @Id
    @GeneratedValue(generator = "jpa-uuid")
    @ApiModelProperty(value = "流程定义ID",name = "id")
    String id;

    @ApiModelProperty("流程定义编码")
    @Column(name = "flow_define_code")
    String flowDefineCode;

    @ApiModelProperty("流程名称")
    @Column(name = "flow_name")
    String flowName;

    @ApiModelProperty("流程描述")
    @Column(name = "description",length = 512)
    String description;

    @ApiModelProperty(value = "流程定义",notes = "JSON字符串")
    @Column(name = "flow_define",length = 10240)
    String flowDefine;

    /**
    List<FlowNodeEntity> nodeList;
     **/

    @ApiModelProperty(value = "流程状态",notes = "1 正常 0 被删除")
    @Column(name = "status")
    Integer status;

    @CreatedDate
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @ApiModelProperty(value = "记录创建时间",name = "createdTime")
    @Column(name = "created_time")
    private Date createdTime;
    @LastModifiedDate
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @ApiModelProperty(value = "记录更新时间",name = "updatedTime")
    @Column(name = "updated_time")
    private Date updatedTime;

}
